package com.ycfmedical.bed.ui.fragment;

import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.jude.rollviewpager.RollPagerView;
import com.jude.rollviewpager.hintview.ColorPointHintView;
import com.ycfmedical.bed.Constants;
import com.ycfmedical.bed.ControlConstants;
import com.ycfmedical.bed.R;
import com.ycfmedical.bed.adapter.ControlImagePlay;
import com.ycfmedical.bed.present.ControlPresenter;

import butterknife.BindView;
import butterknife.OnClick;
import butterknife.Unbinder;
import cn.droidlover.xdroidmvp.imageloader.ILFactory;
import cn.droidlover.xdroidmvp.mvp.XFragment;
import cn.droidlover.xdroidmvp.mvp.XLazyFragment;

/**
 * Created by Administrator on 2017-03-22. 体位控制_CRP（医护专属，患者无权操作）
 */

public class ControlCrpFragment extends XFragment<ControlPresenter>
{

    @BindView(R.id.control_crp)
    ImageView controlCrp;

    private static ControlCrpFragment controlCrpFragment;

    public static ControlCrpFragment newInstance()
    {
        return new ControlCrpFragment();
    }


    public int getType()
    {
        return ControlConstants.CONTROL_CRP;
    }

    @Override
    public void initData(Bundle savedInstanceState)
    {
        ILFactory.getLoader().loadResource(controlCrp, R.drawable.cpraid, null);
    }

    @Override
    public int getLayoutId()
    {
        return R.layout.fragment_control_crp;
    }

    @Override
    public void onStart()
    {
        super.onStart();
    }

    @Override
    public ControlPresenter newP()
    {
        return new ControlPresenter();
    }

    // 重置CPR动画
    public void restart()
    {
        ILFactory.getLoader().loadResource(controlCrp, R.drawable.cpraid, null);
    }

    // CPR动画停止
    public void stopGif()
    {
        if (controlCrp != null)
        {
            controlCrp.post(new Runnable()
            {

                @Override
                public void run()
                {
                    controlCrp.setImageResource(R.drawable.cpraid_stop);
                }

            });
        }
    }
}
